<template>
    <div class="relative h-full z-[10]">
        <!-- <div class="absolute cursor-pointer w-[98px] backbtn justify-center  items-center gap-[4px] text-[14px] text-[#fff] right-[10px] h-[32px]  flex"
            @click="banklast">
            <div class="backleft">
                <el-icon>
                    <ArrowLeft :size="12" />
                </el-icon>
            </div>
            <div>返回上级</div>
        </div> -->
        <div class="h-full flex items-center">
            <div v-if="useDataDashboardThemeStore.building?.buildingInfo?.drawingInfo?.length > 0">
                <div class="flex flex-col gap-[2px] mr-[-10px]">
                    <div class="cursor-pointer clsfk relative"
                        v-for="item in useDataDashboardThemeStore.building?.buildingInfo?.drawingInfo"
                        :key="item.drawingId"
                        :class="` ${useDataDashboardThemeStore?.building?.checkedDrawingId == item.drawingId ? `bg-[#0D3148] bgshowdow text-[#fff]` : ` nobgshow text-[#fff]`}`"
                        @click="checkDrawing(item)">
                            <div class="flex-c relative px-[8px] w-[80px] h-[40px] afrers">
                                <div class="line-clamp-1 leading-[1.2]"> {{ isNullOrEmpty(item.drawingName) }}</div>
                                
                            </div>
                            <div class="badeg" v-if="item.alarmNum+item.expiredFacilitCount>0"  :class="item.alarmNum+item.expiredFacilitCount>9?'py-[2px] px-[3px]':'w-[15px] h-[15px] flex-c'">{{ item.alarmNum+item.expiredFacilitCount }}</div>
                            <div class="topleft" :class="`${useDataDashboardThemeStore?.building?.checkedDrawingId == item.drawingId?'bg-[#4583FF]':'bg-[#1B4161]'}`"></div>
                            <div class="topr" :class="`${useDataDashboardThemeStore?.building?.checkedDrawingId == item.drawingId?'bg-[#4583FF]':'bg-[#1B4161]'}`"></div>
                            <div class="botl" :class="`${useDataDashboardThemeStore?.building?.checkedDrawingId == item.drawingId?'bg-[#4583FF]':'bg-[#1B4161]'}`"></div>
                            <div class="botr" :class="`${useDataDashboardThemeStore?.building?.checkedDrawingId == item.drawingId?'bg-[#4583FF]':'bg-[#1B4161]'}`"></div>
                    </div>
                </div>
            </div>
            <!-- <div v-else>当前项目暂无图纸</div> -->
        </div>
    </div>
</template>
<script lang="ts" setup>
import { isNullOrEmpty } from '@/utils/functions'
import { ArrowLeft } from '@element-plus/icons-vue'
import { useDataDashboardThemeStoreHook } from '@/store/modules/data-dashboard-theme'
import { getDrawingInfo } from '@/api/screen';
const useDataDashboardThemeStore = useDataDashboardThemeStoreHook()
const banklast = () => {
    useDataDashboardThemeStore.CHANGE_SETTING({ key: 'dataDashboardIsHidden', value: 1 })
}
const props = defineProps({
    setshowright: {
        type: Function,
        required: true
    }
})
const checkDrawing = (item) => {
    // 图纸切换
    getDrawingInfo({
        buildingId: useDataDashboardThemeStore.building?.buildingInfo?.buildingInfo?.buildingId,
        drawingId: item.drawingId,
    }).then(res1 => {
        useDataDashboardThemeStore.building.drawingInfo = res1.result
        useDataDashboardThemeStore.building.checkedDrawingId = item.drawingId
        useDataDashboardThemeStore.drawmapid = item.drawingId
    })
}
onMounted(() => {
    props.setshowright()
    console.log('楼层信息', useDataDashboardThemeStore.building?.buildingInfo?.drawingInfo);

})
</script>
<style lang="scss" scoped>
.backbtn {
    background: rgba(19, 17, 65, 0.8);
    border-radius: 4px;
    border: 1px solid #4583FF;
}
.bgshowdow{
    box-shadow: 0px 0px 30px #257cff inset;
}
.nobgshow{
    background-color: rgba(27, 65, 97,.7);
}
.backleft {
    width: 14px;
    height: 14px;
    background: linear-gradient(0deg, rgba(69, 131, 255, 0.78), #FFFFFF);
    border-radius: 50%;
}
.badeg{
    position: absolute;
    left: -4px;
    top: -4px;
    background: #f56c6c;
    color: #fff;
    border-radius: 50%;
    overflow: hidden;
    font-size: 12px;
    z-index: 2;
}
// 给盒子四角加正方形方块 伪元素
.afrers {
    clip-path: polygon(0% 15%, 15% 15%, 15% 0%, 85% 0%, 85% 15%, 100% 15%, 100% 85%, 85% 85%, 85% 100%, 15% 100%, 15% 85%, 0% 85%);
    
}
.clsfk{
    .topleft{
        position: absolute;
        left: 0;
        top: 0;
        width: 4px;
        height: 4px;
        // background: rgb(69, 131, 255);
    }
    .topr{
        position: absolute;
        right: 0;
        top: 0;
        width: 4px;
        height: 4px;
        // background: rgb(69, 131, 255);
    }
    .botl{
        position: absolute;
        left: 0;
        bottom: 0;
        width: 4px;
        height: 4px;
        // background: rgb(69, 131, 255);
    }
    .botr{
        position: absolute;
        right: 0;
        bottom: 0;
        width: 4px;
        height: 4px;
        // background: rgb(69, 131, 255);
    }
}

</style>